import absSubAction from "../abssubcmdaction";
import cmdenums from "../cmdenums";
class ExtendLineAction extends absSubAction.AbsSubAction {
    constructor() {
        super();
        this.mainCMD = cmdenums.EditCmdType.extend;
    }
    
    actCanvasEvt(evt, mainctl) {
        let actRst = null;
        let coordDecs = evt.wx.toFixed(2) + "," + evt.wy.toFixed(2);
        if (evt.subEditModeState == 'start') {
            let cmd = new absSubAction.TCmd();
            cmd.type = 'edit_lmousedown';
            cmd.value = "";
            let nextTips = "继续选择下一根待延长线段。取消（Esc）。直接回车确认之前选择（e）";
            let appendToPreCMD = coordDecs;
            actRst = { cmdObj: cmd, nextTips, appendToPreCMD };
        }
        else if (evt.subEditModeState == 'sureSelLine') {
            let cmd = new absSubAction.TCmd();
            cmd.type = 'edit_lmousedown';
            cmd.value = "";
            let nextTips = "鼠标左键选中延长目标图形。被延长线将与此图形相交并自动修剪。";
            let appendToPreCMD = coordDecs;
            actRst = { cmdObj: cmd, nextTips, appendToPreCMD };
        }
        else if (evt.subEditModeState == 'finish') {
            let cmd = new absSubAction.TCmd();
            cmd.type = 'end';
            cmd.value = "";
            let nextTips = "";//"取消（Esc）.确认直接回车（e）";
            let appendToPreCMD = "";//coordDecs;
            actRst = { cmdObj: cmd, nextTips, appendToPreCMD };
        }
        return actRst;
    }
}

export default { ExtendLineAction }